using MicroMsg.Common.Utils;
using MicroMsg.Plugin;
using MicroMsg.UI.Util;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class PluginItemView : UserControl
	{
		internal ClickableLayout pluginItem;
		internal Image pluginIcon;
		internal TextBlock pluginTitle;
		private bool _contentLoaded;
		public PluginItemView()
		{
			this.InitializeComponent();
		}
		public void InitData(PluginBase plugin)
		{
			if (plugin != null)
			{
				this.pluginItem.set_CommandParameter(plugin.mName);
				this.pluginIcon.set_Source(plugin.mIcon);
				this.pluginTitle.set_Text(Util.capitalString(plugin.mTitle));
			}
		}
		private void button_Click(object sender, RoutedEventArgs e)
		{
			if (sender == null)
			{
				return;
			}
			Button button = sender as Button;
			if (button != null)
			{
				string text = button.get_CommandParameter() as string;
				if (text != null)
				{
					if ("fmessage" == text)
					{
						ToolFunction.GotoPageForUserControl("/Source/UI/Contact/FriendsIntroducePluginView.xaml", null, false);
						return;
					}
					ToolFunction.GotoPageForUserControl("/Source/Plugin/PluginSettingPage.xaml", new object[]
					{
						PluginManager.findPluginByName(text)
					}, false);
				}
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/Setting/PluginItemView.xaml", 2));
			this.pluginItem = (ClickableLayout)base.FindName("pluginItem");
			this.pluginIcon = (Image)base.FindName("pluginIcon");
			this.pluginTitle = (TextBlock)base.FindName("pluginTitle");
		}
	}
}
